<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>修改</legend>
</fieldset>

<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item layui-hide">
        <label class="layui-form-label">id</label>
        <div class="layui-input-block">
            <input type="text" id="id" name="id" lay-verify="domain" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">根域名</label>
        <div class="layui-input-block">
            <input type="text" id="domain" name="domain" lay-verify="required" autocomplete="off" placeholder="请输入网站根域名" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">规则ID</label>
        <div class="layui-input-block">
            <input type="text" id="ruleId" name="ruleId" lay-verify="required" autocomplete="off" placeholder="请输入规则ID" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" id="title" name="title" lay-verify="required" autocomplete="off" placeholder="请输入标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">网址</label>
        <div class="layui-input-block">
            <input type="text" id="url" name="url" lay-verify="required" autocomplete="off" placeholder="请输入网址" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">抓取时间</label>
        <div class="layui-input-block">
            <input type="text" id="createDate" name="createDate" lay-verify="required" autocomplete="off" placeholder="请输入抓取时间" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否下载图片</label>
        <div class="layui-input-block">
            <input type="text" id="isDownload" name="isDownload" lay-verify="authorRegex" autocomplete="off" placeholder="请输入是否下载图片<" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否已下载</label>
        <div class="layui-input-block">
            <input type="text" id="isSuccess" name="isSuccess" lay-verify="dateRegex" autocomplete="off" placeholder="请输入是否已下载" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图片</label>
        <div class="layui-input-block">
            <input type="text" id="images" name="images" lay-verify="contentRegex" autocomplete="off" placeholder="请输入图片" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图片数量</label>
        <div class="layui-input-block">
            <input type="text" id="imageNum" name="imageNum" lay-verify="descriptionRegex" autocomplete="off" placeholder="请输入图片数量" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发布时间</label>
        <div class="layui-input-block">
            <input type="text" id="date" name="date" lay-verify="catalogRegex" autocomplete="off" placeholder="请输入发布时间" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">作者</label>
        <div class="layui-input-block">
            <input type="text" id="author" name="author" lay-verify="tagRegex" autocomplete="off" placeholder="请输入作者" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分类</label>
        <div class="layui-input-block">
            <input type="text" id="category" name="category" lay-verify="required" autocomplete="off" placeholder="请输入分类" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标签</label>
        <div class="layui-input-block">
            <input type="text" id="tags" name="tags" lay-verify="required" autocomplete="off" placeholder="请输入标签" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
            <input type="text" id="content" name="content" lay-verify="exitWayCount" autocomplete="off" placeholder="请输入内容" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <input type="text" id="description" name="description" lay-verify="required" autocomplete="off" placeholder="请输入描述" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
<!--    <div class="layui-form-item">
        <div class="layui-input-block">
            <button id="LAY-user-front-submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
        </div>
    </div>-->
</form>

<script src="../../../layuiadmin/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;
        var $ = layui.$;

        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });
        //监听提交
        $.ajax({
            url: '/spider/detail/get',
            type: 'GET',
            data: {"id": window.location.search.split("id=")[1]},
            dataType : "json",
            success: function (result) {
                if (result.success){
                    //表单初始赋值
                    $("#id").val(result.data.id);
                    $("#domain").val(result.data.domain);
                    $("#ruleId").val(result.data.ruleId);
                    $("#title").val(result.data.title);
                    $("#url").val(result.data.url);
                    $("#createDate").val(result.data.createDate);
                    $("#isDownload").val(result.data.isDownload);
                    $("#isSuccess").val(result.data.isSuccess);
                    $("#images").val(result.data.images);
                    $("#imageNum").val(result.data.imageNum);
                    $("#date").val(result.data.date);
                    $("#author").val(result.data.author);
                    $("#category").val(result.data.category);
                    $("#tags").val(result.data.tags);
                    $("#content").val(result.data.content);
                    $("#description").val(result.data.description);
                    form.render();
                } else {
                    layer.alert("查询失败，原因："+result.message);
                }
            }
        });
    });
</script>

</body>
</html>